<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<script type="text/javascript">
			var a = ['420', '42', '423'];
			
			
			for(var j = 0; j < a.length - 1; j++) {
				for(var i = 0; i < a.length - j; i++) {
					if(a[i]+a[i + 1] < a[i + 1]+a[i]) {
						var c = a[i];  
						a[i] = a[i + 1];
						a[i + 1] = c;
					}
				}
			}
			console.log(a)
		</script>
	</body>

</html>